﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="InterruptController"
	type="http://metalx.org/System/Interrupts/InterruptController"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:hex="http://metalx.org/i386/Functions/Hexadecimal"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:lst="http://metalx.org/i386/Functions/List"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:tm="http://metalx.org/i386/Functions/TaskManager"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:asc="http://metalx.org/Ansi/Ascii"
	xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:inc="http://metalx.org/Intel/80386/Increment"
	xmlns:imm="http://metalx.org/Intel/80386/Immediate"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands"
	xmlns:cmos="http://metalx.org/Pc/Cmos/Ports"
	xmlns:cmr="http://metalx.org/Pc/Cmos/Registers">

	<cls:field name="Address" type="http://metalx.org/Hexadecimal" offset="0"/>

	<cls:method name="GetApicID" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:SI-SIAddress/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<int>0</int>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<hex>10</hex>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>24</byte>

		<cpu:AndAXWithImmediate/>
		<hex>0000000f</hex>

		<hex:CreateObject/>

		<cls:return/>
	</cls:method>

	<cls:method name="GetVersion" type="http://metalx.org/Hexadecimal">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:SI-SIAddress/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<int>1</int>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<hex>10</hex>

		<cpu:AndAXWithImmediate/>
		<hex>000000ff</hex>

		<hex:CreateObject/>

		<cls:return/>
	</cls:method>

	<cls:method name="GetPinCount" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:SI-SIAddress/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<int>1</int>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<hex>10</hex>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>16</byte>

		<cpu:AndAXWithImmediate/>
		<hex>000000ff</hex>

		<cpu:IncrementAX/>

		<int:CreateObject/>

		<cls:return/>
	</cls:method>

	<cls:method name="GetArbitrationID" type="http://metalx.org/Integer">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetData/>

		<cpu:CopyOperandToRegister/>
		<op:SI-SIAddress/>

		<cpu:CopyImmediateToOperandFunction/>
		<imm:CopyImmediateToSIAddress/>
		<int>2</int>

		<cpu:CopyOperandToRegister/>
		<op:AX-SIAddressPlusImmediate8/>
		<hex>10</hex>

		<cpu:ShiftRegisterByImmediate8Function/>
		<shift:ShiftAXRegisterRight/>
		<byte>24</byte>

		<cpu:AndAXWithImmediate/>
		<hex>0000000f</hex>

		<cpu:IncrementAX/>

		<int:CreateObject/>

		<cls:return/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyImmediateToDI/>
		<addressOf ref="type" type="Absolute32"/>

		<str:CreateObject/>

		<cls:return/>

		<var:string id="type">Advanced Programmable Interrupt Controller</var:string>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>
		
		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cls:return/>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class" static="true">
		<cpu:CopyRegisterToOperand/>
		<op:BX-DIRegister/>

		<clsf:CreateObject/>

		<cls:return/>
	</cls:method>
</cls:class>